<?php
class Helper_Definedhtml{
    public static $_vars=array();
    public static $_defineds=array();
    static function load($store_id=0,$htmlName='',$assoc=array()){
        if(is_array($assoc)&&count($assoc)){
            self::$_vars=$assoc;
        }
        if(!isset($_defineds[$store_id.'_'.$htmlName])){
          $base_definedhtml=Q::ini('app_config/ROOT_DIR');
          
          if($store_id){
              $store_definedhtml_path=$base_definedhtml.'/_define/html/'.$store_id.'/';
          }
          $default_definedhtml_path=$base_definedhtml.'/_define/html/default/';
//           if(strlen($htmlName)){
//               $store_definedhtml_path.=$htmlName;
//               $default_definedhtml_path.=$htmlName;
//           }else{
//               return false;
//           }
          
          if(is_file($store_definedhtml_path.Q::ini('language').'/'.$htmlName)){
             $f=file_get_contents($store_definedhtml_path.Q::ini('language').'/'.$htmlName);
          }elseif(is_file($store_definedhtml_path.$htmlName)){
             $f=file_get_contents($store_definedhtml_path.$htmlName);
          }elseif(is_file($default_definedhtml_path.Q::ini('language').'/'.$htmlName)){
             $f=file_get_contents($default_definedhtml_path.Q::ini('language').'/'.$htmlName);
          }elseif(is_file($default_definedhtml_path.$htmlName)){
             $f=file_get_contents($default_definedhtml_path.$htmlName);
          }else{
             return false;
          }
          $_defineds[$store_id.'_'.$htmlName]=$f;
        }
        $d=new Helper_Template;
        $d->_vars=$assoc;
        return $d->pauseTemplate($_defineds[$store_id.'_'.$htmlName]);
    }
}